<?php
/**
 * 种子信息查询
 */
if (empty($regex_matches['s'])) {
    return;
}
$info_hash = $regex_matches['s'];
if (strlen($info_hash) > 40) {
    return;
}
$url = 'https://api.iyuu.cn/index.php?service=App.Api.GetSubject&info_hash=%s';
$url = sprintf($url, $info_hash);
$resp = curl_http_request($url);
if (isset($resp['status']['http_code']) && (200 === $resp['status']['http_code']) && !empty($resp['response'])) {
    $resp = json_decode($resp['response'], true);
    if (isset($resp['ret']) && 200 === $resp['ret']) {
        $data = $resp['data'];
        $rs = '可辅种数量：' . max($data['pid_total'], $data['tid_total']) . PHP_EOL;
        $rs .= '影视链接：' . (empty($data['subject']) ? '暂未收录' : implode(PHP_EOL, $data['subject']));
        echo $rs;
    } else {
        echo $resp['msg'] ?? '未知错误，请访问https://api.iyuu.cn/App.Api.GetSubject 查询';
    }
}
